﻿using System;
using System.Data.SqlClient;
using HQHS.Library.DAL.Interface;


namespace HQHS.Library.DAL
{
    public abstract class GOTCommandBase : ICommand
    {
        private SqlCommand _cmd;
        private bool _disposedValue;

        #region  Public Properties
        /// <summary>
        /// 
        /// </summary>
        public SqlCommand SqlCommand
        {
            get
            {
                if (_cmd == null)
                {
                    _cmd = new SqlCommand();
                }
                return _cmd;
            }
        }
        #endregion

        #region  IDisposable Implementation
        /// <summary>
        /// 
        /// </summary>
        /// <param name="disposing"></param>
        protected void Dispose(bool disposing)
        {
            if (_disposedValue == false)
            {
                if (disposing)
                {

                    // Free unmanaged resources when explicitly called
                    this.SqlCommand.Dispose();
                    _cmd = null;
                }

                // Free shared unmanaged resources

            }
            _disposedValue = true;
        }

        /// <summary>
        /// 
        /// </summary>
        public void Dispose()
        {
            // Do not change this code.  Put cleanup code in Dispose(ByVal disposing As Boolean) above.
            this.Dispose(true);
            GC.SuppressFinalize(this);
        }
        #endregion
    }
}
